package com.ruoyi.bizsys.mapper;

import java.math.BigDecimal;
import java.util.List;

import com.ruoyi.bizsys.domain.CreditAccount;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.bizsys.domain.ProductInfo;
import org.apache.ibatis.annotations.Param;
import org.redisson.api.RAtomicDouble;

/**
 * 授信账户Mapper接口
 *
 * @author african-loan
 * @date 2021-12-30
 */
public interface CreditAccountMapper extends BaseMapper<CreditAccount> {

    /**
     * 查询账户信息
     *
     * @param id 账户信息ID
     * @return 账户信息
     */
    public CreditAccount selectCreditAccountById(Long id);

    /**
     * 查询账户信息列表
     *
     * @param creditAccount 账户信息
     * @return 账户信息集合
     */
    public List<CreditAccount> selectCreditAccountList(CreditAccount creditAccount);

    /**
     * 新增账户信息
     *
     * @param creditAccount 账户信息
     * @return 结果
     */
    public int insertCreditAccount(CreditAccount creditAccount);

    /**
     * 修改账户信息
     *
     * @param creditAccount 账户信息
     * @return 结果
     */
    public int updateCreditAccount(CreditAccount creditAccount);

    /**
     * 删除账户信息
     *
     * @param id 账户信息ID
     * @return 结果
     */
    public int deleteCreditAccountById(Long id);

    /**
     * 批量删除账户信息
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    public int deleteCreditAccountByIds(Long[] ids);


    List<CreditAccount> getOverflowAmount();

    void updateOverflowAmount(@Param("custNo") String custNo, @Param("overflowAmount") BigDecimal overflowAmount);

    void updateFrozenCreditAccount(@Param("custNo") String custNo, @Param("frozenOverflowAmount") BigDecimal frozenOverflowAmount);

    void updateOverflow(@Param("custNo") String custNo, @Param("overflowAmount") BigDecimal overflowAmount, @Param("frozenOverflowAmount") BigDecimal frozenOverflowAmount);


    CreditAccount getNormalAcountOnLoan(String custNo);

    int updateFrozenQuota(@Param("custNo") String custNo, @Param("frozenQuota") BigDecimal frozenQuota);

    int unfreezeQuota(@Param("custNo") String custNo, @Param("unfreezeQuota") BigDecimal unfreezeQuota);

    void updateCreditAccountRest(CreditAccount creditAccount);

    List<CreditAccount> findInCustNos(String customerNo);

    List<ProductInfo> selectCreditAccountProduct(@Param("custNo")String custNo);

    List<CreditAccount> getOnLoanCreditAccountsHasCard();
}
